<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition>

        <p:dialog id="VisitasEncerrarDlg" widgetVar="VisitasEncerrarDialog" modal="true" resizable="false" appendTo="@(body)" header="Encerramento de visita">
            <h:form id="VisitasEncerrarForm">
                <h:panelGroup>
                    <p:commandButton actionListener="#{visitasController.encerrar}" value="Encerrar visita" update=":TbInstListForm,:CliViewVisitasDialogForm,:growl" oncomplete="handleSubmit(args,'VisitasEncerrarDialog');"/>
                    <p:commandButton value="#{bundle.Cancel}" onclick="VisitasEncerrarDialog.hide()" immediate="true" />
                    <br /><br />
                    <p:panelGrid columns="2" rendered="#{visitasController.selectedEncerrar != null}">
                        <p:outputLabel value="#{bundle.CreateTbInstLabel_nomFantasia}" for="nomFantasia" />
                        <p:inputText id="nomFantasia" value="#{visitasController.selectedCliente.nomFantasia}" title="#{bundle.CreateTbInstTitle_nomFantasia}" style="width: 400px;" disabled="true" />
                        <p:outputLabel value="#{bundle.CreateVisitasLabel_dataSaida}" for="dataSaida" />
                        <p:calendar id="dataSaida" pattern="dd/MM/yyyy" mask="99/99/9999" value="#{visitasController.selectedEncerrar.dataSaida}" title="#{bundle.CreateVisitasLabel_dataSaida}" showOn="button" locale="pt"/>
                        <p:outputLabel value="#{bundle.CreateVisitasLabel_horaSaida}" for="horaSaida" />
                        <p:calendar id="horaSaida" pattern="HH:mm" value="#{visitasController.selectedEncerrar.horaSaida}" title="#{bundle.CreateVisitasLabel_horaSaida}"  showOn="none" timeOnly="true" locale="pt" mask="99:99"/>

                        <p:outputLabel value="#{bundle.CreateVisitasLabel_cracha}" for="cracha" />
                        <p:inputText id="cracha" value="#{visitasController.selectedEncerrar.cracha}" title="#{bundle.CreateVisitasTitle_cracha}" required="true" requiredMessage="#{bundle.CreateVisitasRequiredMessage_cracha}"/>
                        <p:outputLabel value="Finalidade da visita" for="finalidadeVisitaId" />
                        <p:selectOneMenu id="finalidadeVisitaId" value="#{visitasController.selectedEncerrar.finalidadeVisitaId}" required="true" requiredMessage="Selecione uma finalidade de visita">
                            <f:selectItem itemLabel="#{bundle.SelectOneMessage}"/>
                            <f:selectItems value="#{finalidadeVisitaController.itemsAvailableSelectOne}" var="finalidadeVisitaIdItem" itemLabel="#{finalidadeVisitaIdItem.id} - #{finalidadeVisitaIdItem.descricao}"  itemValue="#{finalidadeVisitaIdItem}"/>
                        </p:selectOneMenu>
                        <p:outputLabel value="Funcionário" for="funcionario" />
                        <p:selectOneMenu id="funcionario" value="#{visitasController.selectedEncerrar.rhTbFuncionarioCodFunc}" required="false">
                            <f:selectItem itemLabel="#{bundle.SelectOneMessage}"/>
                            <f:selectItems value="#{rhTbFuncionarioController.itemsAvailableSelectOne}" var="rhTbFuncionarioItem" itemLabel="#{rhTbFuncionarioItem.nomeFunc}" itemValue="#{rhTbFuncionarioItem.codFunc}" />
                        </p:selectOneMenu>
                        <p:outputLabel value="#{bundle.CreateVisitasLabel_observacao}" for="observacao" />
                        <p:inputTextarea rows="4" cols="30" id="observacao" value="#{visitasController.selectedEncerrar.observacao}" title="#{bundle.CreateVisitasTitle_observacao}" />
                    </p:panelGrid>
                    <p:commandButton actionListener="#{visitasController.encerrar}" value="Encerrar visita" update=":TbInstListForm,:CliViewVisitasDialogForm,:growl" oncomplete="handleSubmit(args,'VisitasEncerrarDialog');"/>
                    <p:commandButton value="#{bundle.Cancel}" onclick="VisitasEncerrarDialog.hide()" immediate="true" />
                </h:panelGroup>
            </h:form>
        </p:dialog>

    </ui:composition>
</html>
